/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010.

	This file is part of Maxsi Engine.

	Maxsi Engine is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi Engine is distributed in the hope that it will be useful, but WITHOUT
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
	for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	MaxsiEngine.dll
	A general purpose C++ library for the Maxsi Technology Project.

	MaxsiMacros.h
	Useful macros within the Maxsi Engine based projects.

******************************************************************************/

#ifndef MaxsiMacros_H
#define MaxsiMacros_H

#if 0
//=============================================================================
//	Deprecated macros to handle TODO code that should not go into any release
//	builds. Should be replaced by better alternatives from MaxsiError.h.
//=============================================================================
#if NDEBUG && !defined(DEBUG_RELEASE_BUILD)

	#define REMOVEME(Code) Outdated_Debug_Code(); // Replaced by MAXSI_REMOVE_ME[_LOW]
	#define TODO(What_To_Do) _TODO(What_To_Do); // Replaced by MAXSI_TODO[_LOW](What_To_Do)
	#define TODOFAIL() _TODO(); // Replaced by MAXSI_TODO(Message);

#else

	#define REMOVEME(Code) Code // Replaced by MAXSI_REMOVE_ME[_LOW]
	#define TODO(What_To_Do) // Replaced by MAXSI_TODO[_LOW](What_To_Do)
	#define TODOFAIL()// Replaced by MAXSI_TODO(Message);

#endif
#endif

//=============================================================================
//	Memory Deletion Helper Macros Ninja Turtles.
//=============================================================================
#define IFDEL(Pointer) if ( Pointer ) { delete[] Pointer; Pointer = NULL; }
#define IFDELSINGLE(Pointer) if ( Pointer ) { delete Pointer; Pointer = NULL; }
#define IFDELARRRAY(Pointer) if ( Pointer ) { delete[] Pointer; Pointer = NULL; }

//=============================================================================
//	Class model. TODO: We need better naming conventions, and once we do,
//	deprecated this!
//=============================================================================
#define MAXSI_DECLARE_CLASS(Name)
#define MAXSI_DECLARE_CHILD_CLASS(Child, Parent) typedef Parent BaseClass;

//=============================================================================
//	Assert that we don't assert.
//=============================================================================
#ifndef assert
#define assert(ignore)((void) 0)
#endif

//=============================================================================
//	Support for Stack Allocation - Faster, more automatic, less reliable.
//=============================================================================
#ifdef Maxsi_Stack_Alloc_Supported
#ifdef __GNUC__
#include <alloca.h>
#define STACK_ALLOC alloca
#else 
#define STACK_ALLOC _alloca
#endif
#endif

//=============================================================================
//	Hacks to make Maxsi Engine compile using GCC.
//=============================================================================
#ifdef __GNUC__  // Use these instead as they have the MAXSI_ prefix!

	#define MAXSI_THREADED_VARIABLE __thread

	#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
		#define MAXSI_DEPRECATED  __attribute__((__deprecated__))
		#define MAXSI_DEPRECATEDINFO(Information)  __attribute__((deprecated(Information)))
	#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
		#define MAXSI_DEPRECATED  __attribute__((__deprecated__))
		#define MAXSI_DEPRECATEDINFO(Information)  __attribute__((__deprecated__))
	#else
		#define MAXSI_DEPRECATED
		#define MAXSI_DEPRECATEDINFO(Information)
	#endif /* __GNUC__ */

#elif defined(_MSC_VER)

	#define MAXSI_THREADED_VARIABLE __declspec( thread ) 
	#define MAXSI_DEPRECATED __declspec(deprecated("")) 
	#define MAXSI_DEPRECATEDINFO(Information) __declspec(deprecated(Information))

#else

	#error "Deprecated macros has not been defined for this platform!"

#endif

#define MAXSI_FORCE_INLINE

#endif

